package at.fhj.antesk.steamvaluecalc.utils;


public class UrlBuilder {

    private final static String BASE_URL = "http://steamcommunity.com";
    
    private final static String TAB_ALL_FLAG = "&tab=all";
    private final static String GAMES_FLAG = "/games/";
    private final static String APP_ID_FLAG = "/app/";
    private final static String XML_FLAG = "?xml=1";
    private final static String PROFILE_FLAG = "/profiles/";
    private final static String ALIAS_FLAG = "/id/";

    /**
     * Returns the url for the profile page of the given Steam ID.
     * 
     * @param profileId
     * @return
     */
    public static String createProfileUrlForId(String profileId) {
        return (new StringBuilder()) //
            .append(BASE_URL) //
            .append(PROFILE_FLAG) //
            .append(profileId) //
            .append(XML_FLAG) //
            .toString();
    }

    /**
     * Returns the url for the profile page of the given Steam alias (custom url).
     * 
     * @param alias
     * @return
     */
    public static String createProfileUrlForAlias(String alias) {
        return (new StringBuilder()) //
            .append(BASE_URL) //
            .append(ALIAS_FLAG) //
            .append(alias) //
            .append(XML_FLAG) //
            .toString();
    }

    /**
     * Returns the url for the games list for the given Steam ID.
     * 
     * @param profileId
     * @return
     */
    public static String createGameListUrlForId(String profileId) {
        return (new StringBuilder()) //
            .append(BASE_URL) //
            .append(PROFILE_FLAG) //
            .append(profileId) //
            .append(GAMES_FLAG) //
            .append(XML_FLAG) //
            .append(TAB_ALL_FLAG) //
            .toString();
    }

    /**
     * Returns the url for the games list for the given Steam alias (custom url).
     * 
     * @param alias
     * @return
     */
    public static String createGameListUrlForAlias(String alias) {
        return (new StringBuilder()) //
            .append(BASE_URL) //
            .append(ALIAS_FLAG) //
            .append(alias) //
            .append(GAMES_FLAG) //
            .append(XML_FLAG) //
            .append(TAB_ALL_FLAG) //
            .toString();
    }

    /**
     * Returns the community page url for the given appId.
     * 
     * @param appId
     * @return
     */
    public static String createCommunityUrlForAppId(String appId) {
        return (new StringBuilder()) //
            .append(BASE_URL) //
            .append(APP_ID_FLAG) //
            .append(appId) //
            .toString();
    }

}
